﻿using Microsoft.TeamFoundation.Build.Client;
using Microsoft.TeamFoundation.Build.Common;
using Microsoft.TeamFoundation.Build.Workflow.Tracking;
using System;
using System.Activities;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace HybridLab.Workflow.Activities.CodeActivities
{
	public static class CodeActivityLogger
	{
		public static void LogMessage(this CodeActivityContext context, string message, params object[] args)
		{
			context.Track(
				new BuildInformationRecord<BuildMessage>()
				{
					Value = new BuildMessage() { Importance = BuildMessageImportance.High, Message = string.Format(message, args) }
				});
		}

		public static void LogError(this CodeActivityContext context, string error, params object[] args)
		{
			context.Track(
				new BuildInformationRecord<BuildError>()
				{
					Value = new BuildError() { ErrorType = ErrorWarningTypes.Test, Message = string.Format(error, args) }
				});
		}
	}
}
